#ifndef CEPOLLSRV_H
#define CEPOLLSRV_H

#include<memory>
#include<sys/epoll.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<fcntl.h>
#include <arpa/inet.h>
#include<stdlib.h>
#include<iostream>
#include<pthread.h>
//#include<cstdio>
#include<unistd.h>
#include<cstring>

#define __MAX_SOCKFD_COUNT 65535

class CepollSrv
{
public:
    static CepollSrv* Instance();
    ~CepollSrv();
private:
    CepollSrv();
    static std::auto_ptr<CepollSrv> sm_inst;
public:
    bool InitServer(const char* szIp,int iPort);
//    void Listen();
    static void* ListenThread(void* lpVoid);
     void Run();
private:
     int m_iEpollFd;
     int m_iSock;
     sockaddr_in m_listenAddr;   //监听地址
     pthread_t m_ListenThreadId;   //监听线程句柄
};

#endif // CEPOLLSRV_H
